<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/layui/layui.js"></script>
    <link rel="stylesheet" href="../js/layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="" id="addGoodsForm">
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">薪资</label>
        <div class="layui-input-block">
            <input type="text" name="xinzi" lay-verify="required" lay-reqtext="用户名是必填项，岂能为空？" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">学历要求</label>
            <div class="layui-input-inline">
                <input type="tel" name="yaoqiu"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">工作年龄</label>
            <div class="layui-input-inline">
                <input type="text" name="worknian"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">联系人</label>
            <div class="layui-input-inline">
                <input type="text" name="touch"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">招聘人数</label>
        <div class="layui-input-block">
            <input type="text" name="howmany"  placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">职业类别</label>
        <div class="layui-input-inline">
            <input type="text" name="zhiweitype"  placeholder="请输入类别" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">职位描述</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" name="miaoshu"></textarea>
        </div>
    </div>
    <div class="layui-form-item" pane="">
        <label class="layui-form-label">工作性质</label>
        <div class="layui-input-block">
            <input type="radio" name="worktype" value="1">全职
            <input type="radio" name="worktype" value="2">兼职
            <input type="radio" name="worktype" value="3">实习
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">公司待遇</label>
        <div class="layui-input-block">
            <input type="text" name="daiyuid"  placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="save">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;

        //提交监听事件
        form.on('submit(save)', function (data) {
            params = data.field;//表单里面所有的值
            //alert(JSON.stringify(params))//
            submit($,params);
            return false;
        })
    })

    function submit($,params){
        $.post('../zsl/addZhaoPin', params, function (data) {//返回的数据
            if (data) {
                $("#addGoodsForm")[0].reset();
                layer.alert("新增成功")
            }else{
                // parent.location.href='${ctx}/golbal/main';
                layer.alert("次数不够，请购买次数")
            }
        }, 'json');
    }
</script>
</html>